package com.b2b.mall.nacos.provider.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("provider")
@RestController
//@RefreshScope
public class ProviderController {

    @Value("${myName}")
    public String myName;

    @Value("${redis.url}")
    public String redisUrl;

    @Autowired
    Environment environment;

    @GetMapping("hello")
    public String hello() {
        return "hello:" + environment.getProperty("myName");
    }

    @GetMapping("redis")
    public String redis() {
        return "redis:" + redisUrl;
    }
}
